require 'ffi-compiler/compile_task'

FFI::Compiler::CompileTask.new('scrypt_ext') do |t|
  t.cflags << "-Wall -std=c99"
  t.cflags << "-msse -msse2" if t.platform.arch.include? "86"
  t.cflags << "-D_GNU_SOURCE=1" if RbConfig::CONFIG["host_os"].downcase =~ /mingw/
  t.cflags << "-D__need_timespec" if RbConfig::CONFIG['host_os'].downcase =~ /linux/
  t.cflags << "-arch x86_64 -arch i386" if t.platform.mac?
  t.ldflags << "-arch x86_64 -arch i386" if t.platform.mac?
  t.export '../../lib/scrypt/scrypt_ext.rb'

  t.add_define 'WINDOWS_OS' if FFI::Platform.windows?
end
